We get the environment from SwitcherooControl as an array of
key-value pairs. When applying it, we loop over the array in pairs,
assuming that every key has a value.
While this is the expected format, it does not hurt to be defensive
against possible bugs in the service, so explicitly check that both
key and value are non-NULL before applying them.
Spotted by papagai.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4194>
continue;
env_s = g_variant_get_strv (env, NULL);
- for (j = 0; env_s[j] != NULL; j = j + 2)
+ for (j = 0; env_s[j] != NULL && env_s[j+1] != NULL; j = j + 2)
g_app_launch_context_setenv (context, env_s[j], env_s[j+1]);
return;
}